package com.jobanalysis.job_analysis.mapreduce.areaSalary;

import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * @Author: ljq
 * @Date: 2020-03-01 17:19:18
 * @Description: com.jobanalysis.job_analysis.mapreduce.areaSalary
 * @Version: 1.0
 * @Note:
 */
public class JobPredictPredMap extends Mapper<Object, Text, Text, Text> {
    @Override
    protected void map(Object key, Text value, Context context) throws IOException, InterruptedException {
        String[] splitData = value.toString().split("\t");
        //System.out.println(value.toString());
        if ((splitData[4]).contains("datetime") && splitData.length > 8) {
            if (splitData[4].split(":").length > 1&&splitData[4].split(":")[1].split("-").length==2 && splitData[8].split(":").length > 1) {
                Text text = new Text("2019-"+splitData[4].split(":")[1]);
                context.write(text, new Text(splitData[8].split(":")[1]));
            }
        }
    }
}
